<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <input type="text" id="txt">
    <input type="button" id="btn" value="判断">



    <script>
        var txt = document.getElementById('txt')
        var btn = document.getElementById('btn')
        btn.onclick = function (){
            var year = txt.value
            if(year%4===0&&year%100!==0||year%400===0){
                alert(year+"年是闰年")
            }else{
                alert(year+"年是平年")
            }    
        }

        function fun2(i){
            if(i>0){
                console.log("正数")
            }else if(i===0){
                console.log("零")
            }else{
                console.log("负数")
            }
        }
        fun2(-1)

        function fun3(a){
            if(a%2){
                console.log("奇数")
            }else{
                console.log("偶数")
            }
        }
        fun3(4)


        function fun4(w,h){
            var res = (h-108)*2
            if(res>w+10||res<w-10){
                console.log("身材不标准")
            }else{
                console.log("身材标准")
            }
        }
        fun4(120,165)

        function fun5(date){
            switch(date){
                case 0:console.log("星期日");break
                case 1:console.log("星期一");break
                case 2:console.log("星期二");break
                case 3:console.log("星期三");break
                case 4:console.log("星期四");break
                case 5:console.log("星期五");break
                case 6:console.log("星期六");break
                default:console.log("请输入0~6之间的数字")
            }
        }
        fun5(7)

        function fun6(cj){
            // if(cj>=0&&cj<60){
            //     console.log("不及格")
            // }else if(cj>=60&&cj<70){
            //     console.log("及格")
            // }else if(cj>=70&&cj<80){
            //     console.log("还行")
            // }else if(cj>=80&&cj<90){
            //     console.log("不错")
            // }else if(cj>=90&&cj<=100){
            //     console.log("优秀")
            // }else{
            //     console.log("请输入0~100之间的数字")
            // }

            switch(true){
                case cj>=0&&cj<60:console.log("不及格");break;
                case cj>=60&&cj<70:console.log("及格");break;
                case cj>=70&&cj<80:console.log("还行");break;
                case cj>=80&&cj<90:console.log("不错");break;
                case cj>=90&&cj<=100:console.log("优秀");break;
                default:console.log("请输入0~100之间的数字")
            }
        }
        fun6(80)



        var sum =0;
        function fun7(year1,month,day){
            switch(month){
                case 12:sum = sum+30
                case 11:sum = sum+31
                case 10:sum = sum+30
                case 9:sum = sum+31
                case 8:sum = sum+31
                case 7:sum = sum+30
                case 6:sum = sum+31
                case 5:sum = sum+30
                case 4:sum = sum+31
                case 3:if(year1%4===0&&year1%100!==0||year1%400===0){
                    sum = sum +29
                }else{
                    sum = sum +28
                }
                case 2:sum = sum+31
                case 1:sum = sum+day;break
                default:console.log("请输入正确的数值")
            }
            console.log(sum)
        }
        fun7(2000,2,30)

        function fun8(hour,rate){
            var money = 0;
            if(hour<=40&&hour>=0){
                money = hour*rate
                console.log(money)
            }else{
                money = 40*rate+(hour-40)*1.5*rate
                console.log(money)
            }
        }
        fun8(50,40)




        function fun9(year2,m){
            switch(m){
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:console.log("31天");break
                case 4:
                case 6:
                case 9:
                case 11:console.log("30天");break
                case 2:if(year2%4===0&&year2%100!==0||year2%400===0){
                    console.log("29天")
                }else{
                    console.log("28天")
                }
                default:console.log("请输入正确的数字")
            }
        }
        fun9(2000,3)
    </script>
    
</body>
</html>